<%@ include file="/common/taglibs.jsp"%>
<script>
jQuery(document).ready(function(){
	jQuery("#pwdForm").validate();
});
</script>

<s:form name="pwdForm" id="pwdForm" action="updatePassword" method="post" validate="true">
	<s:hidden id="user.id" name="user.id"/>
    <input type="hidden" name="encryptPass" value="true" />
   
	<%-- <li class="buttonBar right">
		<s:submit id="save" value="Change Password" onclick="return onFormSubmit(this.form)"/>
		<s:submit key="button.cancel" method="cancel"/>
	</li> --%>
   	<table>
		<tr>
			<td width="40%">Current Password</td>
			<td width="60%"><s:password id="currentPassword" name="currentPassword" cssClass="text medium required" required="true"/></td>
		</tr>
   	 
  		 <tr>
			<td width="40%">New Password</td>
			<td width="60%"><s:password id="password" name="password"  required="true" cssClass="text medium required"/></td>
		</tr>
   		 <tr>
			<td width="40%">Confirm Password</td>
			<td width="60%"><s:password  id="confirmPassword" name="confirmPassword"  required="true" cssClass="text medium required"/></td>
		</tr>
    </table>
    <li class="buttonBar bottom">
        <s:submit id="save" value="Change Password" onclick="return onFormSubmit(this.form)"/>
        <s:submit key="button.cancel" method="cancel"/>
    </li>
</s:form>

<script type="text/javascript">
<!-- This is here so we can exclude the selectAll call when roles is hidden -->
function onFormSubmit(theForm) {
  var currentPassword = document.getElementById(('currentPassword').value;
  var password = document.getElementById(('password').value;
  var confirmPassword = document.getElementById(('confirmPassword').value;
  if(password != confirmPassword){
	 alert("Password and Confirm Password should be same");	
	 return false;
  }
  if(currentPassword==password){
	  alert("Current Password and New Password is same. Please change");
	  return false;
  }
  return true;
}
</script>
